package com.PAT.practice02;
import java.util.*;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: zjz
 * @Date: 2021/12/16/23:57
 * @Description:
 * @Target:
 *
 */
public class 数字分类 {


    /*
      a1  能被 5 整除的数字中所有偶数的和；
      a2   将被 5 除后余 1 的数字按给出顺序进行交错求和，即计算 n1-n2+n3-n4  // 偶数是负,奇数是正
      a3  被 5 除后余 2 的数字的个数；
      a4   被 5 除后余 3 的数字的平均数，精确到小数点后 1 位；
      a5   被 5 除后余 4 的数字中最大数字。
    * */
    public static void main(String[] args) {
        int a1 = 0;
        int a2 = 0;
        int a3 = 0;
        double a4 = 0;
        int a5 = 0;
        int count = 1; // 记录正负加
        int count1 = 0;


        Scanner in = new Scanner(System.in);
        String ss =in.nextLine();
        String[] s = ss.split(" ");
        int[] arr1 = new int[s.length-1];
        for (int i = 1; i < s.length; i++) {
            arr1[i-1]=Integer.valueOf(s[i]);
        }

        for (int i : arr1) {
            if (i%5==0&&i%2==0){
                a1+=i;
            }
            if (i%5==1){

                if (count%2==1){
                    a2+=i;
                }else {
                    a2-=i;
                }
                count++;
            }

            if (i%5==2){
                a3++;
            }

            if (i%5==3){
                a4+=i;
                count1++;
            }

            if (i%5==4){
                if (a5<i){
                    a5 = i;
                }
            }
        }

        System.out.print(dealWith(a1)+" ");
        if (count!=1){
            if (a2!=0){
                System.out.print(dealWith(a2));
            }else {
                System.out.print("0");
            }

        }else {
            System.out.print(dealWith(a2));
        }
        System.out.print(" "+dealWith(a3)+" ");
        if (a4!=0){
            System.out.format("%.1f",(a4/count1));
        }else {
            System.out.print("N");
        }
        System.out.print(" "+dealWith(a5));
        System.out.println();


    }

    public static String  dealWith(int a){
        String ss = a==0?"N":a+"";
        return ss;
    }
}


